import React, { Component } from 'react'
import { Button, Drawer, Upload, Icon, Divider, Row, Modal } from 'antd';
import { BasicLayout, BasicLayoutSearch } from './BasicLayout';
import { BasicPagination, TableCustomize, openSuccessModal, openModalMessage } from './TableCustomize';
import SearchForm from './SearchForm';
import SearchForm1 from './SearchForm1';
import AddForm from './AddForm';
import { getDate, getDateYYYYwo } from '../../../utils/action';
import { baseUrl, toLead } from '../../../config';
import * as APIService from '../../../axios/api_yq'
import { withPermission } from '../../../components/withpermission'
const CreateButton = withPermission(Button, 'plus')
const DeleteButton = withPermission(Button, 'line')
const PrintButton = withPermission(Button, 'printer')
const DownLoadButton = withPermission(Button, 'download')
const UploadButton = withPermission(Button, 'upload')
const { confirm } = Modal
export default class WeekPlan extends Component {
    state = {
        dataSource: [],
        paging: {},
        visible: false,
        formData: {},
        drawerVisible: false,
        drawerTitle: '',
        one: false,
        loading: false,
        some: null,
        selectedRows: [],
        advanced: false,
        values: {},
        selectedRowKeys: [],
        tabsKey: '1',   //页面key
        buttonLoading: false,

        advanced1: false,  //计划变更记录高级查询
        versions: null,
        values1: {},
        search1: [],  //请求数据
        paging1: {},
        rowSelections: [],

        buttonList: []
    };
    UNSAFE_componentWillMount() {
        this.fetch()
        this.fetch1()  //计划变更记录
    }
    componentWillUnmount() {
        this.setState = () => {
            return;
        };
    }
    //初始化加载数据
    fetch = (pageNum = 1, pageSize = 100) => {
        const { values } = this.state
        const buttonList = JSON.parse(localStorage.getItem('buttonList'))
        // console.log('这是按钮', buttonList);
        if (buttonList ? buttonList.length !== 0 : null) {
            this.setState({
                buttonList
            })
        }
        this.setState({
            loading: true,
            one: false,
            drawerVisible: false,
            formData: {},
            paging: { pageNum: pageNum, pageSize: pageSize }
        })
        let a = { pageNum: pageNum, pageSize: pageSize }
        setTimeout(() => {
            this.search({ ...values, ...a })
        }, 300);
    }
    // 计划版本管理初始化加载数据
    fetch1 = (pageNum = 1, pageSize = 10) => {
        const { values1, paging1 } = this.state
        this.setState({
            paging1: { pageNum: pageNum, pageSize: pageSize }
        }, () => {
            console.log('有没有', values1);
            this.search1({ ...values1, ...paging1 })
        })

    }
    // 查询接口
    search = (value, paging) => {
        this.setState({ loading: true })
        APIService.queryByCondition3(value, paging).then((item) => {
            console.log('查询数据', item);
            if (item.data.code === 200) {
                this.setState({
                    loading: false,
                    dataSource: item.data.data.data,
                    // 操作后清除选中
                    selectedRowKeys: [],
                    selectedRows: [],
                    some: null,
                    paging: {
                        pageNum: item.data.data.pageNum,
                        pageSize: item.data.data.pageSize,
                        total: item.data.data.total,
                    }
                })
            } else {
                openModalMessage('error', item.data.msg)
            }
        })
    }
    //计划变更记录查询接口
    search1 = (pagings) => {
        APIService.queryPlanWeekChange(pagings).then((item) => {
            console.log('计划管理页查询接口', item);
            if (item.data.code === 200) {
                this.setState({
                    search1: [
                        { dataSource: item.data.data.data },
                        {
                            pageNum: item.data.data.pageNum,
                            pageSize: item.data.data.pageSize,
                            total: item.data.data.total,
                        }
                    ]
                }, () => { console.log(this.state.search1); })
            } else {
                openModalMessage('error', item.data.msg)
            }
        })
    }

    // 新增接口/修改
    newData = (data) => {
        const { values, paging } = this.state
        APIService.addWeekPlan(data).then((item) => {
            console.log(item);
            if (item.data.code === 200) {
                openSuccessModal(item.data.msg)
                this.handleCancel()
                this.search({ ...values, ...paging })
                this.fetch1()
            } else {
                this.setState({
                    buttonLoading: false
                })
                openModalMessage('error', item.data.msg)
            }
        })
    }
    // 删除接口
    deletes = (data) => {
        const { values, paging } = this.state
        APIService.deletePlanWeek(data).then((item) => {
            console.log(item);
            if (item.data.code === 200) {
                openSuccessModal(item.data.msg)
                this.search({ ...values, ...paging })
                this.fetch1()
            } else {
                openModalMessage('error', item.data.msg)
            }
        })
    }
    // 编辑当前行
    deleteRow = (b) => {
        this.setState({
            one: true,
            drawerVisible: true,
            formData: b,
            drawerTitle: '编辑'
        });
    }
    // 单条删除
    deleteRow1 = (b) => {
        const then = this
        let id = `idList=${[b.id]}`
        confirm({
            title: '确认删除当项吗，这将影响其他数据模块?',
            onOk() {
                then.deletes(id)
            },
            onCancel() {
            },
        })
    }
    // 确定新增/修改
    onHandleOk = () => {
        const { formData, one } = this.state
        this.formDrawer.validateFields((err, value) => {
            if (err) return;
            console.log('新增数据', value)
            let assemblyElectrical = null
            let assemblyLine = null
            let assembleStartTime = null
            let columnFrame = null
            let columnSlide = null
            // let dataOutputTime = null
            // let endTime = null
            let firstDeliveryTime = null
            let firstOutputTime = null
            let hotWorksDivision = null
            let hydraulicCircuit = null
            let hydraulicMaterial = null
            let oilCylinder = null
            let peripheralBusinessDivision = null
            let purchasedPart = null
            let rack = null
            let rackAffix = null
            let rackPlate = null
            let week = null

            value.assemblyElectrical !== undefined && value.assemblyElectrical !== null ? assemblyElectrical = getDate(value.assemblyElectrical._d) : assemblyElectrical = null
            value.assemblyLine !== undefined && value.assemblyLine !== null ? assemblyLine = getDate(value.assemblyLine._d) : assemblyLine = null
            value.assembleStartTime !== undefined && value.assembleStartTime !== null ? assembleStartTime = getDate(value.assembleStartTime._d) : assembleStartTime = null
            value.columnFrame !== undefined && value.columnFrame !== null ? columnFrame = getDate(value.columnFrame._d) : columnFrame = null
            value.columnSlide !== undefined && value.columnSlide !== null ? columnSlide = getDate(value.columnSlide._d) : columnSlide = null
            // value.dataOutputTime !== undefined && value.dataOutputTime !== null ? dataOutputTime = getDate(value.dataOutputTime._d) : dataOutputTime = null
            // value.endTime !== undefined && value.endTime !== null ? endTime = getDate(value.endTime._d) : endTime = null
            value.firstDeliveryTime !== undefined && value.firstDeliveryTime !== null ? firstDeliveryTime = getDate(value.firstDeliveryTime._d) : firstDeliveryTime = null
            value.firstOutputTime !== undefined && value.firstOutputTime !== null ? firstOutputTime = getDate(value.firstOutputTime._d) : firstOutputTime = null
            value.hotWorksDivision !== undefined && value.hotWorksDivision !== null ? hotWorksDivision = getDate(value.hotWorksDivision._d) : hotWorksDivision = null
            value.hydraulicCircuit !== undefined && value.hydraulicCircuit !== null ? hydraulicCircuit = getDate(value.hydraulicCircuit._d) : hydraulicCircuit = null
            value.hydraulicMaterial !== undefined && value.hydraulicMaterial !== null ? hydraulicMaterial = getDate(value.hydraulicMaterial._d) : hydraulicMaterial = null
            value.peripheralBusinessDivision !== undefined && value.peripheralBusinessDivision !== null ? peripheralBusinessDivision = getDate(value.peripheralBusinessDivision._d) : peripheralBusinessDivision = null
            value.oilCylinder !== undefined && value.oilCylinder !== null ? oilCylinder = getDate(value.oilCylinder._d) : oilCylinder = null
            value.purchasedPart !== undefined && value.purchasedPart !== null ? purchasedPart = getDate(value.purchasedPart._d) : purchasedPart = null
            value.rack !== undefined && value.rack !== null ? rack = getDate(value.rack._d) : rack = null
            value.rackAffix !== undefined && value.rackAffix !== null ? rackAffix = getDate(value.rackAffix._d) : rackAffix = null
            value.rackPlate !== undefined && value.rackPlate !== null ? rackPlate = getDate(value.rackPlate._d) : rackPlate = null
            value.week !== undefined && value.week !== null ? week = getDateYYYYwo(value.week._d) : week = null

            let stage = `${value.stage}`
            let data = {
                ...value,
                ...formData,
                stage,
                assemblyElectrical,
                assemblyLine,
                assembleStartTime,
                columnFrame,
                columnSlide,
                // dataOutputTime,
                // endTime,
                firstDeliveryTime,
                firstOutputTime,
                hotWorksDivision,
                hydraulicCircuit,
                hydraulicMaterial,
                peripheralBusinessDivision,
                oilCylinder,
                purchasedPart,
                rack,
                rackAffix,
                rackPlate,
                week
            }
            let data1 = {
                ...value,
                stage,
                assemblyElectrical,
                assemblyLine,
                assembleStartTime,
                columnFrame,
                columnSlide,
                // dataOutputTime,
                // endTime,
                firstDeliveryTime,
                firstOutputTime,
                hotWorksDivision,
                hydraulicCircuit,
                hydraulicMaterial,
                peripheralBusinessDivision,
                oilCylinder,
                purchasedPart,
                rack,
                rackAffix,
                rackPlate,
                week
            }
            console.log('添加', data1);
            console.log('修改', data);
            this.setState({
                buttonLoading: true
            }, () => {
                this.newData(one === false ? data1 : data)
            })
        })
    }
    // 取消
    handleCancel = e => {
        this.formDrawer && this.formDrawer.resetFields();
        this.setState({
            one: false,
            drawerVisible: false,
            formData: {},
            buttonLoading: false
        });
    };
    // 条件查询查询
    handleSearch = value => {
        console.log('查询数据', value);
        const { paging } = this.state
        let a = { pageNum: paging.pageNum, pageSize: paging.pageSize }
        let week = null
        let firstDeliveryTime = null
        let firstOutputTime = null
        value.week !== null && value.week !== undefined ?
            week = getDateYYYYwo(value.week._d) : week = null
        value.firstDeliveryTime !== null && value.firstDeliveryTime !== undefined ?
            firstDeliveryTime = getDate(value.firstDeliveryTime._d) : firstDeliveryTime = null
        value.firstOutputTime !== null && value.firstOutputTime !== undefined ?
            firstOutputTime = getDate(value.firstOutputTime._d) : firstOutputTime = null
        let versions = { ...value, week, firstDeliveryTime, firstOutputTime }
        console.log(versions);
        this.setState({
            values: versions
        })
        this.search({ ...versions, ...a })
    };
    //计划变更记录查询
    handleSearch1 = value => {
        const { paging1 } = this.state
        let changeTime = ''
        let a = { pageNum: paging1.pageNum, pageSize: paging1.pageSize }
        if (value.changeTime !== null && value.changeTime !== undefined) {
            changeTime = getDate(value.changeTime._d)
        }
        let versions = { ...value, changeTime }
        this.setState({
            values1: versions
        })
        this.search1({ ...versions, ...a })
    };
    // 当前行编辑
    loadData = (value, dataSource) => {
        console.log('在表格行编辑后保存的数据', value, dataSource)
        this.newData(value)
        this.fetch()
    }
    //0新增  1修改
    create = () => {
        this.setState({
            one: false,
            drawerVisible: true,
            formData: {},
            drawerTitle: '新增'
        });
    };
    // 选中删除
    allStart = () => {
        const { selectedRows, some } = this.state
        let selectedRows1 = [...selectedRows]
        let ids = []
        selectedRows1.forEach(item => {
            ids.push(item.id)
        })
        let id = `idList=${ids}`
        if (some !== null && some > 0) {
            this.deletes(id)
        } else {
            openModalMessage('error', '未选中')
        }
    }
    // 打印
    allStop = () => {
        console.log('打印');
        // var printInnerHTML = window.document.getElementById('prints').innerHTML;
        // window.document.body.innerHTML = printInnerHTML
        // window.print()
        // window.location.reload()
    }
    // 导出模板
    derive = () => {
        APIService.exportExcelDemo2().then(res => {
            //设置下载文件类型为xlsx 不同的类型type也不一样，创建URL对象
            let url = window.URL.createObjectURL(new Blob([res.data], { type: 'application/vnd.openxmlformats-officedocument.spreadsheetml.sheet' }))
            // 创建A标签
            let link = document.createElement('a')
            link.style.display = 'none'
            link.href = url
            // 设置的下载文件文件名
            const fileName = decodeURI('周计划管理');
            // 触发点击方法
            link.setAttribute('download', fileName)
            document.body.appendChild(link)
            link.click()
        })
    }
    // 导出选中
    derive2 = () => {
        const { selectedRows, some } = this.state
        if (some > 0 && some !== null && some !== 0) {
            APIService.exportExcel2(selectedRows).then((res) => {
                //设置下载文件类型为xlsx 不同的类型type也不一样，创建URL对象
                let url = window.URL.createObjectURL(new Blob([res.data], { type: 'application/vnd.openxmlformats-officedocument.spreadsheetml.sheet' }))
                // 创建A标签
                let link = document.createElement('a')
                link.style.display = 'none'
                link.href = url
                // 设置的下载文件文件名
                const fileName = decodeURI('周计划管理');
                // 触发点击方法
                link.setAttribute('download', fileName)
                document.body.appendChild(link)
                link.click()
            })
        } else {
            openModalMessage('error', '请选中导出项')
        }
    }
    // 导出选中-计划变更页
    derive3 = () => {
        const { rowSelections } = this.state
        let some = rowSelections[0]
        let data = rowSelections[1]
        if (some > 0 && some !== null && some !== 0) {
            APIService.exportChangeReport1(data).then((res) => {
                //设置下载文件类型为xlsx 不同的类型type也不一样，创建URL对象
                let url = window.URL.createObjectURL(new Blob([res.data], { type: 'application/vnd.openxmlformats-officedocument.spreadsheetml.sheet' }))
                // 创建A标签
                let link = document.createElement('a')
                link.style.display = 'none'
                link.href = url
                // 设置的下载文件文件名
                const fileName = decodeURI('周计划-变跟记录');
                // 触发点击方法
                link.setAttribute('download', fileName)
                document.body.appendChild(link)
                link.click()
            })
        } else {
            openModalMessage('error', '请选中导出项')
        }
    }
    // 重置
    cz = () => {
        this.setState({
            values: null
        }, () => { this.fetch() })
    }
    // 重置-计划变更记录
    cz1 = () => {
        this.setState({
            values1: {}
        }, () => {
            this.fetch1()
        })

    }
    // 高级查询
    advancedss = () => {
        this.setState({ advanced: !this.state.advanced })
    }
    //计划变更记录高级查询
    advancedss1 = () => {
        this.setState({ advanced1: !this.state.advanced1 })
    }
    // 按钮点击事件
    // btnClick = (a) => {
    //     if (a === 0) {
    //         this.create()
    //     }
    //     if (a === 1) {
    //         this.allStart()
    //     }
    //     if (a === 2) {
    //         this.allStop()
    //     }
    //     if (a === 3) {
    //         this.derive()
    //     }
    //     if (a === 4) {
    //         this.derive2()
    //     }
    // }
    render() {
        const then = this
        const { buttonLoading, values1, buttonList, selectedRows, search1, versions, tabsKey, selectedRowKeys, advanced, advanced1, some, one, paging, loading, dataSource, formData, drawerVisible, drawerTitle } = this.state;
        const rowSelection = {
            columnWidth: 60,
            type: 'checkbox',
            selectedRowKeys: selectedRowKeys,
            onChange: (selectedRowKeys, selectedRows) => {
                let some = [...selectedRows].length
                this.setState({
                    some: some,
                    selectedRows: selectedRows,
                    selectedRowKeys: selectedRowKeys
                }, () => {
                    console.log('选中个数', this.state.some, '选中详细数据', this.state.selectedRows);
                })
            },
            // 固定在左侧
            // fixed: true
        }
        const columns = [
            {
                title: '序号',
                dataIndex: 'number',
                width: 50,
                align: 'center',
                fixed: 'left',
                render: (text, record, index) =>
                    <div>
                        {index + 1}
                    </div>
            },
            {
                title: '机型',
                dataIndex: 'model',
                width: 180,
            },

            {
                title: '批号',
                width: 100,
                dataIndex: 'batchNo',
            },
            {
                title: '装配机号',
                width: 100,
                dataIndex: 'assemblyNo',
            },
            {
                title: '车间',
                width: 100,
                dataIndex: 'attributeFirst',
            },
            {
                title: '台量',
                width: 80,
                dataIndex: 'stage',
            },
            {
                title: '装配部门',
                width: 100,
                dataIndex: 'assemblyDept',
            },
            {
                title: '计划周',
                width: 130,
                dataIndex: 'week',
            },
            {
                title: '装配开始时间',
                width: 150,
                dataIndex: 'assembleStartTime',
                editable: true,
            },
            {
                title: '第一交机时间',
                width: 150,
                dataIndex: 'firstDeliveryTime',
                editable: true,
            },
            {
                title: '第一出机时间',
                width: 150,
                dataIndex: 'firstOutputTime',
                editable: true,
            },
            {
                title: '机架',
                width: 150,
                dataIndex: 'rack',
                editable: true,
            },
            {
                title: '机架附件',
                width: 150,
                dataIndex: 'rackAffix',
                editable: true,
            },
            {
                title: '机架钣金',
                width: 150,
                dataIndex: 'rackPlate',
                editable: true,
            },
            {
                title: '油缸',
                width: 150,
                dataIndex: 'oilCylinder',
                editable: true,
            },
            {
                title: '液压油路',
                width: 150,
                dataIndex: 'hydraulicCircuit',
                editable: true,
            },
            {
                title: '液压打料',
                width: 150,
                dataIndex: 'hydraulicMaterial',
                editable: true,
            },
            {
                title: '柱架',
                width: 150,
                dataIndex: 'columnFrame',
                editable: true,
            },
            {
                title: '柱架滑座',
                width: 150,
                dataIndex: 'columnSlide',
                editable: true,
            },
            {
                title: '总装电器',
                width: 150,
                dataIndex: 'assemblyElectrical',
                editable: true,
            },
            {
                title: '总装管路',
                width: 150,
                dataIndex: 'assemblyLine',
                editable: true,
            },
            {
                title: '外购件',
                width: 150,
                dataIndex: 'purchasedPart',
                editable: true,
            },
            {
                title: '周边事业部',
                width: 150,
                dataIndex: 'peripheralBusinessDivision',
                editable: true,
            },
            {
                title: '热作件事业部',
                width: 150,
                dataIndex: 'hotWorksDivision',
                editable: true,
            },
            {
                title: '客户',
                width: 80,
                dataIndex: 'customer',
            },
            {
                title: '创建人',
                width: 100,
                dataIndex: 'creater',
            },
            {
                title: '创建时间',
                width: 150,
                dataIndex: 'createTime',
            },
            {
                title: '操作',
                dataIndex: 'opts',
                width: 100,
                fixed: 'right',
                render:
                    (text, record) =>
                        <div>
                            <a onClick={this.deleteRow.bind(this, record)}>{'编辑'}</a>
                            <Divider type="vertical" />
                            <a onClick={this.deleteRow1.bind(this, record)}>{'删除'}</a>
                        </div>
            },
            { dataIndex: '' }
        ]
        // 打印数据
        const columns1 = [
            {
                title: '序号',
                dataIndex: 'number',
                width: 60,
                ellipsis: true,
                render: (text, record, index) =>
                    <div>
                        {index + 1}
                    </div>
            },
            {
                title: '机型',
                dataIndex: 'model',
                ellipsis: true,
                width: 100,
            },

            {
                title: '批号',
                width: 100,
                dataIndex: 'batchNo',
                ellipsis: true,
            },
            {
                title: '装配机号',
                width: 80,
                dataIndex: 'assemblyNo',
                ellipsis: true,
            },
            {
                title: '台量',
                width: 60,
                dataIndex: 'stage',
                ellipsis: true,
            },
            {
                title: '装配部门',
                width: 80,
                dataIndex: 'assemblyDept',
                ellipsis: true,
            },
            // {
            //     title: '资料输出时间',
            //     width: 100,
            //     dataIndex: 'dataOutputTime',
            //     ellipsis: true,
            // },
            {
                title: '装配开始时间',
                width: 100,
                dataIndex: 'assembleStartTime',
                ellipsis: true,
            },
            {
                title: '第一交机时间',
                width: 100,
                dataIndex: 'firstDeliveryTime',
                ellipsis: true,
            },
            // {
            //     title: '试机/补漆/包装结束时间',
            //     width: 100,
            //     dataIndex: 'endTime',
            //     ellipsis: true,
            // },
            {
                title: '第一出机时间',
                width: 100,
                dataIndex: 'firstOutputTime',
                ellipsis: true,
            },
            {
                title: '备注',
                width: 120,
                dataIndex: 'remark',
                ellipsis: true,
            },
            {
                title: '创建人',
                width: 60,
                dataIndex: 'creater',
                ellipsis: true,
            },
            {
                title: '创建时间',
                width: 100,
                dataIndex: 'createTime',
                ellipsis: true
            }
        ]
        // 导入周管理计划
        const propss = {
            name: 'file',
            action: `${baseUrl}${toLead}/planWeekManage/importExcel`,
            accept: '.xls,.xlsx',
            method: 'post',
            showUploadList: true,
            headers: {
                userId: localStorage.getItem('userId'),
                Token: localStorage.getItem('token'),
            },
            onChange(info) {
                console.log('这是', info);
                if (info.file.status !== 'uploading') {
                    console.log('这是什么', info.file, info.fileList);
                }
                if (info.file.status === 'done') {
                    openSuccessModal(info.file.response.msg)
                    then.fetch()
                    then.fetch1()
                } else if (info.file.status === 'error') {
                    openModalMessage('error', info.file.response.msg)
                }
            },
        }
        return (
            <div>
                {
                    tabsKey === '1' ? <BasicLayoutSearch>
                        <SearchForm onSearch={this.handleSearch}
                            onClick={this.cz}
                            onClick1={this.advancedss}
                            advanced={advanced}
                        />
                    </BasicLayoutSearch>
                        : tabsKey === '2' ? null
                            : tabsKey === '3' ? <BasicLayoutSearch>
                                <SearchForm1 onSearch={this.handleSearch1}
                                    onClick={this.cz1}
                                    onClick1={this.advancedss1}
                                    advanced1={advanced1}
                                />
                            </BasicLayoutSearch>
                                : null
                }
                <BasicLayout
                    versions={versions}
                    search1={search1}
                    paging1={(data) => {
                        this.setState({
                            paging1: data
                        }, () => {
                            this.search1({ ...values1, ...data })
                        })
                    }}
                    rowSelection={(data) => {
                        this.setState({
                            rowSelections: data
                        })
                    }}
                    name="周计划管理"
                    name1='周计划-甘特图'
                    name2='周计划-变更记录'
                    name3='周计划-审批管理'
                    icon="table"
                    icon1='area-chart'
                    icon2='carry-out'
                    icon3='carry-out'
                    buttons={
                        tabsKey === '1' ?
                            [
                                <CreateButton key={1} onClick={this.create} icon='plus' />,
                                <DeleteButton key={2} onClick={this.allStart} icon='line' />,
                                <PrintButton key={5} onClick={this.allStop} icon='printer' />,
                                <DownLoadButton key={3} onClick={this.derive} icon='download' text="导出模板" />,
                                <DownLoadButton key={4} onClick={this.derive2} icon='download' text="导出选中" />,
                                <Upload {...propss} key={6}>
                                    <UploadButton icon='upload' />
                                </Upload>,

                                // <Button key={1} onClick={this.create} type="primary" icon='plus'>新增</Button>,
                                // <Button key={2} onClick={this.allStart} type="primary" icon='line'>删除</Button>,
                                // <Button key={3} onClick={this.allStop} type="primary" icon='printer'>打印</Button>,
                                // <Button key={4} onClick={this.derive} type="primary" icon='download'>导出模板</Button>,
                                // <Button key={6} onClick={this.derive2} type="primary" icon='download'>导出选中</Button>,
                                // <Upload {...propss} key={5}>
                                //     <Button type="primary">
                                //         <Icon type="upload" /> 导入
                                //     </Button>
                                // </Upload>,
                            ]
                            // [
                            //     buttonList.length !== 0 ? buttonList.map((value, index) => {
                            //         return value.buttonName === '导入' ? <Upload {...propss} key={`${5}_upload`}>
                            //             <Button type="primary">
                            //                 <Icon type="upload" /> 导入
                            //             </Button>
                            //         </Upload> : <Button key={value.id} onClick={this.btnClick.bind(this, index)} type={value.description} icon={value.buttonCode}>{value.buttonName}</Button>
                            //     }) : null
                            // ]
                            : tabsKey === '2' ? []
                                : tabsKey === '3' ? [
                                    // <Button key={1} onClick={this.derive3} type="primary" icon='download'>导出选中</Button>,
                                    <DownLoadButton key={9} onClick={this.derive3} text="导出选中" />,
                                ]
                                    : []
                    }
                    tabsKey={(data) => {
                        this.setState({
                            tabsKey: data
                        }, () => { console.log('当前页', this.state.tabsKey); })
                    }}
                >
                    <TableCustomize
                        rowSelection={rowSelection}
                        columns={columns}
                        rowKey={(record) => record.id}
                        dataSource={dataSource}
                        pagination={false}
                        loading={loading}
                        allowDrafting={true}
                        allowEditable={this.loadData}
                        scroll={{ x: true, y: 600 }}
                        rowClassName={(record, index) => {
                            return (['editable-row', index % 2 === 0 ? 'editable-row' : 'editable-row12'])
                        }}
                    />
                    <BasicPagination pageNum={paging.pageNum} pageSize={paging.pageSize} total={paging.total} loadData={this.fetch} />
                </BasicLayout>
                <Drawer width={800} visible={drawerVisible} title={drawerTitle} onClose={this.handleCancel} destroyOnClose maskClosable={false}>
                    <AddForm
                        formData={formData}
                        one={one}
                        onOk={this.onHandleOk}
                        ref={node => (this.formDrawer = node)}
                        onClose={this.handleCancel}
                    />
                    <div
                        style={{
                            position: 'absolute',
                            right: 0,
                            bottom: 0,
                            width: '100%',
                            borderTop: '1px solid #e9e9e9',
                            padding: '10px 16px',
                            background: '#fff',
                            textAlign: 'right',
                        }}
                    >
                        <Button onClick={this.handleCancel} style={{ marginRight: 10 }}>{'取消'}</Button>
                        <Button type="primary" onClick={this.onHandleOk} loading={buttonLoading}>
                            {'确认'}
                        </Button>
                    </div>
                </Drawer>

                <div id='prints' style={{ display: 'none' }}>
                    <div style={{ textAlign: 'center', margin: '10px 0' }}>
                        <Row style={{ fontSize: 20, fontWeight: 700 }}>{'周计划'}</Row>
                    </div>
                    <TableCustomize
                        columns={columns1}
                        rowKey={(record) => record.id}
                        dataSource={
                            some === 0 || some === null ? dataSource : selectedRows}
                        pagination={false}
                        scroll={{ x: false }}
                    />
                    <div style={{ width: '100%', textAlign: 'center', marginTop: '20px' }}>
                        <Row style={{}}>第{1}页,共{1}页</Row>
                    </div>
                </div>
            </div>
        )
    }
}

